package impl.dao;

import entity.User;
import face.dao.IUserDao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author futao
 * Created on 18-2-5-下午10:47.
 */
@Repository
public class UserDaoImpl implements IUserDao {
    @Resource
    private SessionFactory sessionFactory;

    public List<User> list() {
        Session session = sessionFactory.getCurrentSession();
        return session.createCriteria(User.class)
                      .setFirstResult(0)
                      .setMaxResults(10)
                      .list();
    }
}
